2017-01-04 8 views
13

में सभी निर्भरताओं को स्थापित करने के लिए requirement.txt का उपयोग कैसे करें मैं अजगर के लिए नया हूं। हाल ही में मुझे अजगर द्वारा लिखित एक परियोजना मिली है और इसके लिए कुछ स्थापना की आवश्यकता है। मैं स्थापित करने के लिए कमांड चलाता हूं लेकिन एक त्रुटि मिली है।एक पायथन परियोजना

# pip install requirements.txt 
Collecting requirements.txt 
    Could not find a version that satisfies the requirement requirements.txt (from versions:) 
No matching distribution found for requirements.txt 

मैं गूगल पर खोज की है और इस लिंक http://stackoverflow.com/questions/28167987/python-pip-trouble-installing-from-requirements-txt पाया, लेकिन मैं काफी है कि पोस्ट में क्या समाधान समझ में नहीं आता।

# cat requirements.txt 
ordereddict==1.1 
argparse==1.2.1 
python-dateutil==2.2 
matplotlib==1.3.1 
nose==1.3.0 
numpy==1.8.0 
pymongo==3.3.0 
psutil>=2.0 

वहाँ एक आसान तरीका यह अजगर परियोजना में सभी आवश्यक निर्भरता स्थापित करने के लिए है:

नीचे मेरी requirements.txt फ़ाइल है?

EDIT1

नीचे pip3 install -r requirements.txt से उत्पादन होता है।

# pip3 install -r requirements.txt 
Requirement already satisfied: ordereddict==1.1 in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 1)) 
Collecting argparse==1.2.1 (from -r requirements.txt (line 2)) 
    Using cached argparse-1.2.1.tar.gz 
Collecting python-dateutil==2.2 (from -r requirements.txt (line 3)) 
    Using cached python-dateutil-2.2.tar.gz 
Collecting matplotlib==1.3.1 (from -r requirements.txt (line 4)) 
    Using cached matplotlib-1.3.1.tar.gz 
    Complete output from command python setup.py egg_info: 
    ============================================================================ 
    Edit setup.cfg to change the build options 

    BUILDING MATPLOTLIB 
       matplotlib: yes [1.3.1] 
        python: yes [3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 
          5.4.0 20160609]] 
        platform: yes [linux] 

    REQUIRED DEPENDENCIES AND EXTENSIONS 
        numpy: yes [version 1.11.3] 
        dateutil: yes [using dateutil version 2.6.0] 
        tornado: yes [tornado was not found. It is required for the 
          WebAgg backend. pip/easy_install may attempt to 
          install it after matplotlib.] 
       pyparsing: yes [using pyparsing version 2.1.10] 
        pycxx: yes [Official versions of PyCXX are not compatible 
          with Python 3.x. Using local copy] 
        libagg: yes [pkg-config information for 'libagg' could not 
          be found. Using local copy.] 
        freetype: no [The C/C++ header for freetype2 (ft2build.h) 
          could not be found. You may need to install the 
          development package.] 
         png: yes [pkg-config information for 'libpng' could not 
          be found. Using unknown version.] 

    OPTIONAL SUBPACKAGES 
       sample_data: yes [installing] 
        toolkits: yes [installing] 
        tests: yes [using nose version 1.3.7] 

    OPTIONAL BACKEND EXTENSIONS 
        macosx: no [Mac OS-X only] 
        qt4agg: no [PyQt4 not found] 
        gtk3agg: no [gtk3agg backend does not work on Python 3] 
       gtk3cairo: no [Requires cairo to be installed.] 
        gtkagg: no [Requires pygtk] 
        tkagg: no [TKAgg requires Tkinter.] 
        wxagg: no [requires wxPython] 
         gtk: no [Requires pygtk] 
         agg: yes [installing] 
        cairo: no [cairo not found] 
       windowing: no [Microsoft Windows only] 

    OPTIONAL LATEX DEPENDENCIES 
        dvipng: no 
       ghostscript: no 
        latex: no 
        pdftops: no 

    ============================================================================ 
          * The following required packages can not be built: 
          * freetype 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-don4ne_2/matplotlib/ 

मैं पहले से ही libfreetype6-dev स्थापित किया है लेकिन पिप आदेश अभी भी इस निर्भरता लापता की रिपोर्ट।

# apt-get install libfreetype6-dev 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
libfreetype6-dev is already the newest version (2.6.1-0.1ubuntu2). 
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded. 
+8

'पिप -r requirements.txt' – MrLeeh

+0

स्थापित मैं उत्पादन को अद्यतन किया है -r ध्वज के साथ उत्पादन शामिल करने के लिए लेकिन अभी भी स्थापित करने में सक्षम नहीं है। –

+0

तो अब नया आउटपुट पढ़ें और सोचें - हमारे लिए प्रतीक्षा न करें। उत्पादन में – furas

उत्तर

8

आप लिनक्स ओएस उपयोग कर रहे हैं:

  1. requirements.txt
  2. से निकालें matplotlib==1.3.1
  3. sudo apt-get install python-matplotlib
  4. भागो pip install -r requirements.txt (अजगर 2), या pip3 install -r requirements.txt (अजगर 3)
  5. pip freeze > requirements.txt
  6. साथ स्थापित करने के लिए प्रयास करें

आप Windows OS का उपयोग कर रहे हैं:

  1. python -m pip install -U pip setuptools
  2. python -m pip install matplotlib
+3

हाय नीलेश, स्टैक ओवरफ़्लो में आपका स्वागत है। भविष्य में, कृपया अपने उत्तर में दिए गए आदेशों के स्पष्टीकरण को शामिल करें, न केवल लोगों को आदेश चलाने के लिए कहें। – yakatz

4

pip install -r requirements.txtpython 2.x

python 3.x के लिए pip3 install -r requirements.txt के लिए (मामले में एक से अधिक संस्करण स्थापित कर रहे हैं)

+0

पर 'apt-get'' मैंने दोनों को आजमाया लेकिन अभी भी असफल रहा। मैंने इस कमांड से आउटपुट पोस्ट किया है। –

+0

मुझे लगता है कि MATPLOTLIB स्थापित करने के लिए एक आवश्यक निर्भरता 'freetype' गायब है।निर्भरता स्थापित करने का प्रयास करें और फिर से स्थापित pip install -r requirements.txt चलाएं। –

+0

'पीपी 'सिस्टम स्तर निर्भरताओं को संभाल नहीं पाएगा। जारी रखने से पहले आपको 'libfreetype6-dev' इंस्टॉल करना होगा'। (यह आपके आउटपुट में भी सही कहता है। अगली बार ऐसी त्रुटियों के लिए इसे स्किम करने का प्रयास करें, आमतौर पर आउटपुट का निर्माण बहुत विस्तृत होता है) –

0

(मेरी टिप्पणी से लिया)

pip प्रणाली के स्तर निर्भरता संभाल नहीं होंगे। जारी रखने से पहले आपको apt-get install libfreetype6-dev करना होगा। (यह भी अपने उत्पादन में तो सही कहते हैं आम तौर पर निर्माण आउटपुट बहुत विस्तृत हैं ऐसी त्रुटियों के लिए अगली बार जब यह खत्म हो गया स्कीम करने का प्रयास करें।)

+0

मैंने पहले से ही libfreetype6-dev स्थापित किया है। लेकिन पीआईपी अभी भी इस त्रुटि की रिपोर्ट करता है। –

+0

क्या आप इस बग को देखते थे? https://github.com/matplotlib/matplotlib/issues/3029/ –

संबंधित मुद्दे