2016-02-26 31 views
9

Tôi đang cài đặt gói sử dụng dependency_links. Có vẻ như để cài đặt các gói alright nhưng phá vỡ chức năng đóng băng pip (có thể có nghĩa là có một vấn đề cài đặt sâu hơn.) Tôi muốn để có thể tải về các gói từ một máy chủ tùy chỉnh mà không cần thiết lập bất kỳ bên ngoài chạy setup.py.`pip freeze` ngắt với cài đặt gói

Đây là setup.py tập tin của tôi:

from setuptools import setup 

    setup(
     name='package' 
     ,version='0.1.0' 
     ,packages=['foo', 
       'bar' 
       ] 
     ,long_description='' 
     ,url='https://github.com/myrepo' 
     ,install_requires=['numpy>=1.9.2' 
         ,'some_package' 
         ] 
     ,dependency_links=[ 
      "http://custom_server/packages/some_package-0.1.0.tar.gz" 
     ]    
) 

Install dường như làm việc ok, nhưng nếu tôi cố gắng và chạy pip_freeze tôi nhận được báo lỗi dưới đây.

pip freeze 

Error [Errno 20] Not a directory: '/Users/abc/anaconda/lib/python2.7/site-packages/some_package.egg' while executing command git rev-parse 
Exception: 
Traceback (most recent call last): 
    File "/Users/myname/anaconda/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main 
    status = self.run(options, args) 
    File "/Users/myname/anaconda/lib/python2.7/site-packages/pip/commands/freeze.py", line 70, in run 
    for line in freeze(**freeze_kwargs): 
    File "/Users/myname/anaconda/lib/python2.7/site-packages/pip/operations/freeze.py", line 49, in freeze 
    dependency_links 
    File "/Users/myname/anaconda/lib/python2.7/site-packages/pip/__init__.py", line 235, in from_dist 
    if dist_is_editable(dist) and vcs.get_backend_name(location): 
    File "/Users/myname/anaconda/lib/python2.7/site-packages/pip/vcs/__init__.py", line 75, in get_backend_name 
    if vc_type.controls_location(location): 
    File "/Users/myname/anaconda/lib/python2.7/site-packages/pip/vcs/git.py", line 266, in controls_location 
    on_returncode='ignore') 
    File "/Users/myname/anaconda/lib/python2.7/site-packages/pip/vcs/__init__.py", line 322, in run_command 
    spinner) 
    File "/Users/myname/anaconda/lib/python2.7/site-packages/pip/utils/__init__.py", line 677, in call_subprocess 
    cwd=cwd, env=env) 
    File "/Users/myname/anaconda/lib/python2.7/subprocess.py", line 710, in __init__ 
    errread, errwrite) 
    File "/Users/myname/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child 
    raise child_exception 
OSError: [Errno 20] Not a directory: '/Users/myname/anaconda/lib/python2.7/site-packages/some_package.egg' 
+0

Tôi biết nó phải làm với thực tế rằng nó là một tập tin trứng chứ không phải là một thư mục trứng nhưng tôi không biết làm thế nào để sửa chữa nó. – Chris

+0

thử thêm # trứng = some_package-0.1.0 vào liên kết phụ thuộc của bạn – irqed

+0

'http: // custom_server/packages/some_package-0.1.0.tar.gz # egg = some_package-0.1.0' đã cho tôi lỗi tương tự khi tôi chạy pip đóng băng. Việc cài đặt vẫn hoạt động, nó chỉ phá vỡ pip đóng băng:/ – Chris

Trả lời

4

pip install . với --extra-index-url--trusted-host hiện các trick, còn nếu bạn muốn cài đặt nó trong chế độ chỉnh sửa bạn có thể làm pip install -e ..

Bạn vẫn có thể muốn có một cái nhìn tại dependency_links niêm yết và tùy chọn zip_safe: https://pythonhosted.org/setuptools/setuptools.html#dependencies-that-aren-t-in-pypi https://pythonhosted.org/setuptools/setuptools.html#setting-the-zip-safe-flag https://github.com/irqed/octokit.py/blob/master/setup.py#L51

Bằng cách này bạn có thể chỉ định --extra-index-url--trusted-host trong tập tin requirements.txt pip là tốt.

Các vấn đề liên quan